gh-143935: Email preserve parens when folding comments (#143936)
authorSeth Michael Larson <seth@python.org>
Mon, 19 Jan 2026 12:38:22 +0000 (06:38 -0600)
committerArnaud Rebillout <arnaudr@debian.org>
Tue, 14 Apr 2026 04:38:32 +0000 (11:38 +0700)
commit75e77a21083c9cbed211e70c4002c8429066d3fc
tree4c365aa5b80c86e9a3d3ed71abb69f6474af7cf4
parent921c6fed011d661b857a564993d71d10fec76b48
gh-143935: Email preserve parens when folding comments (#143936)

Fix a bug in the folding of comments when flattening an email message
using a modern email policy. Comments consisting of a very long sequence of
non-foldable characters could trigger a forced line wrap that omitted the
required leading space on the continuation line, causing the remainder of
the comment to be interpreted as a new header field. This enabled header
injection with carefully crafted inputs.

Co-authored-by: Denis Ledoux <dle@odoo.com>
Origin: backport, https://github.com/python/cpython/commit/17d1490aa97bd6b98a42b1a9b324ead84e7fd8a2

Gbp-Pq: Name CVE-2025-11468.patch
Lib/email/_header_value_parser.py
Lib/test/test_email/test__header_value_parser.py
Misc/NEWS.d/next/Security/2026-01-16-14-40-31.gh-issue-143935.U2YtKl.rst [new file with mode: 0644]